package com.design.pattern.combinationAndVisitor;


import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;


/**
 * 删除权限操作
 * @author zhonghuashishan
 *
 */
@Component
@Scope("prototype") 
public class RemovePriorityOperation implements PriorityOperation<Boolean> { 


	/**
	 * 访问权限树节点
	 * @param node 权限树节点
	 */
	@Override
	public Boolean doExecute(Priority node) throws Exception {
//		List<PriorityDO> priorityDOs = priorityDAO
//				.listChildPriorities(node.getId());
//
//		if(priorityDOs != null && priorityDOs.size() > 0) {
//			for(PriorityDO priorityDO : priorityDOs) {
//				Priority priorityNode = priorityDO.clone(Priority.class);
//				priorityNode.execute(this);
//			}
//		}
		//根据nodeid 向上或向下组
		System.out.println("根据id查询数据库 然后向上或向下组装树形结构");

		System.out.println("节点调用 execute(this)  每一个节点都执行当前的操作 添加、删除、修改");

		removePriority(node);
		return true;
	}
	
	/**
	 * 删除权限
	 * @param node 权限树节点
	 */
	private void removePriority(Priority node) throws Exception {
		System.out.println("dao 根据id 删除权限");
//		priorityDAO.removePriority(node.getId());
	}

}
